// nco.v: numerically controlled oscillator
// 2006-06-21 E. Brombaugh

module nco(
  input wire clock, 
  input wire reset, 
  input wire enable, 
  input wire [23:0] frequency_in,
  output reg [23:0] phase_out
  // input wire [dsz-1:0] frequency_in, 
  // output reg [dsz-1:0] phase_out
  );
  
  //  parameter dsz = 24;      // phase accumulator width

  
  // synchronous binary up counter with enable
  always @(posedge clock or posedge reset)
    if(reset)
      phase_out <= {24{1'b0}};
    else
      if(enable)
        phase_out <= phase_out + frequency_in;

endmodule

